package com.smec.remes.util;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;

import com.smec.moblie.R;
import com.smec.remes.bean.query.PackingList;

/**
 * Created by Administrator on 2017/12/9.
 */

public class ScreenDialog extends Dialog {
    private Context context;
    private View customView;
    private EditText edMantr,edName,edNo,edLadder,edPicture;

    public ScreenDialog(Context context, int themeResId) {
        super(context, themeResId);
        this.context = context;
        this.setCanceledOnTouchOutside(true);
        LayoutInflater inflater = LayoutInflater.from(context);
        customView = inflater.inflate(R.layout.screen_dialog, null);
        edMantr= (EditText) customView.findViewById(R.id.ed_mantr);
        edName= (EditText) customView.findViewById(R.id.ed_name);
        edNo= (EditText) customView.findViewById(R.id.ed_no);
        edLadder= (EditText) customView.findViewById(R.id.ed_ladder);
        edPicture= (EditText) customView.findViewById(R.id.ed_picture);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(customView);
    }

    public View findViewById(int id) {
        return super.findViewById(id);
    }

    public View getCustomView() {
        return customView;
    }

    public void _clear(){
        edMantr.setText("");
        edName.setText("");
        edNo.setText("");
        edLadder.setText("");
        edPicture.setText("");
    }

    public PackingList _PackList(){
        PackingList packingList=new PackingList();
        packingList.setIdnrk(edMantr.getText().toString().toUpperCase());
        packingList.setTitle(edName.getText().toString().toUpperCase());
        packingList.setPackingNo(edNo.getText().toString().toUpperCase());
        packingList.setClassName(edLadder.getText().toString().toUpperCase());
        packingList.setGwgno(edPicture.getText().toString().toUpperCase());
        return packingList;
    }
}
